import zmail

# 发送邮件内容
# 读取html文件
with open("html文件路径", "r", encoding="utf-8") as f:
    content_html = f.read()
mail_content = {
    "subject": "邮件主题",
    "content_text": content_html,    # 邮件内容,邮件正文
    "attachments": "userdata.xlsx",  # 邮件附件  直接填写文件路径
}

# 使用发送邮件的账号和密码:密码是授权码不是邮箱登陆密码
server = zmail.server("账号", "授权码")

# 发送邮箱
server.send_mail("账号", mail_content)

# 给多人发送邮箱
server.send_mail(["收件人1", "收件人2"], "邮件内容")
